<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        new Promise((resolve,reject)=>{

        console.log('开始请求数据A....');
        try{
            // 模拟异步代码
            setTimeout(()=>{
                console.log('请求数据A成功');
                const name = {
                    name : 'ssds'
                }
                resolve(name);
            },1500)
        }catch(e){
            reject(e.message)
        }
        })
        .then((value)=>{
            console.log('开始请求数据B....');
        try{
            // 模拟异步代码
            setTimeout(()=>{
                console.log('请求数据B成功');
                const age = {
                    age : 18
                }
                resolve({...value,...name});
            },1500)
        }catch(e){
            reject(e.message)
        }
        })
    </script>
</body>
</html>